home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / Expander / Expander Classes / CStream_Expander.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  2.1 KB  |  76 lines  |  [TEXT/KAHL]

  1. /***********************************************************************************
  2.     CStream_Expander.cpp
  3.  
  4.     Copyright © 1994 B-Ray Software. All rights reserved.
  5.     Developed using Symantec C++ 7.0.2 and Symantec's TCL library.
  6.     Portions of this code courtesy Symantec, Inc.
  7.  
  8.     This code may be freely distributed as long as this notice remains. This code
  9.     may not be used in any commercial software without the consent of B-Ray Software.
  10.  
  11.     ---
  12.  
  13.     This file expands most of the Expander classes with the CStream template.
  14.  
  15. ***********************************************************************************/
  16. #include <TCLClassInfo.h>
  17. #include <CStream.h>
  18.  
  19.  
  20. #include "CExpandorama.h"
  21. #include "CExpanderPane.h"
  22.  
  23.  
  24. #pragma template_access public
  25.  
  26.  
  27. #pragma template PutObject( CStream &, CExpanderPane* )
  28. #pragma template GetObject( CStream &, CExpanderPane* & )
  29. #pragma template PutObjectReference( CStream &, CExpanderPane* )
  30.  
  31. #pragma template PutObject( CStream &, CExpandorama* )
  32. #pragma template GetObject( CStream &, CExpandorama* & )
  33. #pragma template PutObjectReference( CStream &, CExpandorama* )
  34.  
  35.  
  36. /*
  37.  * GetObject - OVERRIDE
  38.  *
  39.  * We need to convert the object from the stream, which is a CPane or CPanorama
  40.  * object, to a CFamily type. This is the only time we cannot determine the class
  41.  * to work from, hence the member() call.
  42.  */
  43.  
  44. void GetObject( CStream &stream, CFamily *&aChild )
  45. {
  46.     CExpanderPane    *aPane;
  47.  
  48.     GetObject( stream, (CView *)aPane );    // get object from stream
  49.     if ( aPane == NULL ) {
  50.         aChild = NULL;                        // don't bother with it
  51.     }
  52.     else if ( member( aPane, CExpandorama ) == TRUE ) {
  53.         aChild = ((CExpandorama *)aPane)->PaneToChild();    // CExpandorama derivative
  54.     }
  55.     else {
  56.         aChild = aPane->PaneToChild();                        // CExpanderPane derivative
  57.     }
  58. }
  59.  
  60.  
  61. /*
  62.  * PutObject - OVERRIDE
  63.  *
  64.  * Convert from the CFamily type to its CPane/CPanorama equivalent. No need to check
  65.  * the class type since we are starting from CFamily.
  66.  */
  67.  
  68. void PutObject( CStream &stream, CFamily *aChild )
  69. {
  70.     CPane    *aPane = aChild ? aChild->ChildToPane() : NULL;
  71.     PutObject( stream, (CView *)aPane );
  72. }
  73.  
  74.  
  75. #include <CStream.tem>
  76.